package com.example.springboot.mapper;

import com.example.springboot.domain.Collect;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

@Mapper
@Component(value ="collectMapper")
public interface CollectMapper {

    @Insert("insert into collect (userId,fid,module) values (#{userId},#{fid},#{module})")
    public void insert(Collect collect);

    @Select("select * from collect where collect.userId = #{userId} and collect.fid = #{fid}")
    public Collect selectUserCollect(Collect collect);

    @Delete("delete from collect where fid=#{id}")
    public void deleteById(Integer id);

    @Select("select count(*) from collect where fid = #{fid}")
    public int selectByFidAndModule(@Param("fid") Integer fid, @Param("module") String module);
}
